package com.zuilapsa.jmc.actions;

import java.util.*;
import org.dom4j.Element;

import com.zuilapsa.jmc.model.*;


public abstract class ActionNull implements ActionInterface {
	HashMap<String, String> attributes = new HashMap<String, String>();
	Element definition;
//	public abstract void execute(UserInterfaceSession interfaceSession, String[] args) throws JmcException;

	public void setAttribute(String name, String value) {
		attributes.put(name, value);
	}

	public String getAttibute(String name) {
		return attributes.get(name);
	}

	public void removeAttibute(String name) {
		attributes.remove(name);
	}

	public void setDefinition(Element definition) {
		this.definition = definition;
		attributes = new HashMap<String, String>();
		for (Iterator i = definition.elementIterator("attribute"); i.hasNext();) {
			Element el = (Element)i.next();
			setAttribute(el.attributeValue("name"),el.attributeValue("value"));
		}
	}
	public Element getDefinition() {
		return definition;
	}
	public DefinitionWrapper getDefinitionWrapper() {
		return new DefinitionWrapper(definition);
	}
	public void setParent(Level parent) {
		//do nothing
	}
	public String getName() {
		return definition.attributeValue("name");
	}
	public String getHelpString() {
		return definition.attributeValue("help","No help available for this action.");
	}
}
